<div class="container">

    <?php echo $this->element('page_header'); ?>

    <div class="row">
        <div class="span12">

            <div id="big-stats-container" class="widget">

                <div class="widget-content" style="padding: 0px 15px 0px;">

                    <div id="big_stats" class="cf">
                        <div class="stat">
                            <h4 style="font-size: 12px">Assigned Tickets Total</h4>
                            <span class="value"><?php echo $user_ticket_stats['assigned_ticket_total']; ?></span>
                        </div> <!-- .stat -->

                        <div class="stat">
                            <h4 style="font-size: 12px">Created Tickets Total</h4>
                            <span class="value">
                                <?php echo $user_ticket_stats['created_ticket_total']; ?>
                            </span>
                        </div> <!-- .stat -->

                        <div class="stat">
                            <h4 style="font-size: 12px">Closed Tickets</h4>
                            <span class="value">
                                <?php echo $user_ticket_stats['closed_ticket_total']; ?>
                            </span>
                        </div> <!-- .stat -->

                        <div class="stat">
                            <h4 style="font-size: 12px">Quick Link</h4>
                            <span class="value">
                                <?php
                                    if($can_create_ticket){
                                    ?>
                                        <a href="<?php echo $this->Html->url(array('controller' => 'Tickets', 'action' => 'create_ticket')); ?>" class="btn btn-large btn-secondary btn-support-contact " style="display: block; margin-bottom: .75em;">Create New Ticket</a>
                                    <?php
                                    }
                                    else{
                                    ?>
                                        <a href="<?php echo $this->Html->url(array('controller' => 'TicketUpdates', 'action' => 'index')); ?>" class="btn btn-large btn-secondary btn-support-contact " style="display: block; margin-bottom: .75em;">All Ticket</a>
                                    <?php
                                    }
                                ?>
                            </span>
                        </div> <!-- .stat -->
                    </div>

                </div> <!-- /widget-content -->

            </div> <!-- /widget -->

        </div>

        <div class="span6">

            <div class="widget">

                <div class="widget-header">
                    <h3>
                        <i class="icon-th-list"></i>
                       Menu
                    </h3>
                </div> <!-- /widget-header -->

                <div class="widget-content">
                    <div class="shortcuts">
                        <?php
                            foreach($group_modules as $mod){
                                $url = $mod['url'];
                                $url_arr = explode('/',$url);
                                $controller = $url_arr[0];
                                $action = $url_arr[1];
                                $name = $mod['name'];
                                $icon = $mod['icon'];
                        ?>
                                <a href="<?php echo $this->Html->url(array('controller' => $controller, 'action' => $action)); ?>" class="shortcut">
                                    <i class="shortcut-icon <?php echo $icon ;?>"></i>
                                    <span class="shortcut-label"><?php echo $name ;?></span>
                                </a>
                        <?php
                            }
                        ?>

                    </div> <!-- /.shortcuts -->
                </div> <!-- /widget-content -->

            </div> <!-- /widget -->

        </div>

        <div class="span6">

            <div class="widget">

                <div class="widget-header">
                    <h3>
                        <i class="icon-bar-chart"></i>
                        Assigned Tickets Preview
                    </h3>
                </div> <!-- /widget-header -->

                <div class="widget-content">
                    <div class="widget widget-table">

                        <div class="widget-content">

                            <table class="table table-bordered table-striped table-highlight">
                                <thead>
                                <tr>
                                    <th>Ticket #</th>
                                    <th>Subject</th>
                                    <th>Priority</th>
                                    <th>Time Elapse</th>
                                    <th>Action</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php
                                    foreach($data_table as $dat){
                                        $big_dt = date('Y-m-d');
                                        $set_end = $dat['Status']['set_end'];
                                        if($set_end == 'Closed'){
                                            $big_dt = $dat['Ticket']['modified'];
                                        }
                                        $days = $this->App->count_days_between_dates($dat['Ticket']['created'],$big_dt);
                                ?>
                                    <tr>
                                        <td><?php echo $dat['Ticket']['id'];?></td>
                                        <td><?php echo $dat['Ticket']['subject'];?></td>
                                        <td><?php echo $dat['Priority']['name'];?></td>
                                        <td><?php echo $days.' Day(s)';?></td>
                                        <td>
                                            <a class="quick_action_links" href="<?php echo $this->Html->url(array('controller' => 'TicketUpdates','action'=>'update_ticket/'.$dat['Ticket']['id'])); ?>">
                                                <?php echo $this->Html->image('edit.png', array('title'=>'Update Ticket','alt' =>'Update')); ?>
                                            </a>
                                            &nbsp; | &nbsp;
                                            <a class="quick_action_links" href="<?php echo $this->Html->url(array('controller' => 'TicketUpdates','action'=>'track_ticket/'.$dat['Ticket']['id'])); ?>">
                                                <?php echo $this->Html->image('track.png', array('title'=>'Track Ticket','alt' =>'Track')); ?>
                                            </a>
                                        </td>
                                    </tr>
                                <?php
                                    }
                                ?>
                                </tbody>
                            </table>
                        </div> <!-- /widget-content -->

                    </div>
                </div> <!-- /widget-content -->

            </div> <!-- /widget -->

        </div>


       <!-- <div id="iphone-scrollcontainer">
            <div id="iphone-inside">
                <div id="unlock-top">
                    <p id="timepicker" class="time">08:23</p>
                    <p id="datepicker" class="date">Wednesday, July 6</p>
                </div>
                <div id="unlock-spacer">
                    &nbsp;
                </div>
                <div id="unlock-bottom">
                    <div id="slide-to-unlock"></div>
                    <div id="unlock-slider-wrapper">
                        <div id="unlock-slider"><div id="unlock-handle"></div></div>
                    </div>
                </div>
            </div>
        </div>-->


    </div> <!-- /.row -->

</div> <!-- /.container -->

<?php
    echo $this->Html->script('Scripts/dashboard.js');
?>